home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / cmds / mkmf.man < prev    next >
Encoding:
Text File  |  1991-05-24  |  26.9 KB  |  604 lines

  1. ' $Header: /sprite/src/cmds/mkmf.prog/RCS/mkmf.man,v 1.11 91/05/23 17:03:22 kupfer Exp $ SPRITE (Berkeley)
  2. .so \*(]ltmac.sprite
  3. .HS MKMF cmds
  4. .BS
  5. .SH NAME
  6. mkmf \- generate Makefiles automatically
  7. .SH SYNOPSIS
  8. \fBmkmf\fR [\fB\-f \fImakefile\fR] [\fB\-x\fR] [\fB\-m \fImachineType\fR]
  9. [\fB-m\fImachineType\fR]
  10. .SH OPTIONS
  11. .IP "\fB\-f \fImakefile\fR"
  12. Generate a file named \fImakefile\fR
  13. instead of \fBMakefile\fR.  Also use \fImakefile.\fBproto\fR,
  14. \fImakefile.\fBed\fR, and \fImakefile\fR.\fBex\fR instead of
  15. \fBMakefile.proto\fR etc.
  16. .IP "\fB\-x\fR"
  17. Turns on echo-ing so that all the commands in the \fBmkmf\fR scripts
  18. are printed on the terminal.  This is useful primarily for
  19. debugging \fBmkmf\fR scripts.
  20. .IP "\fB\-m \fImachineType\fR or \fB-m\fImachineType\fR"
  21. Work only on subdirectory for
  22. \fImachineType\fR. Multiple \fB\-m\fR flags
  23. can be used to run \fBmkmf\fR on multiple machine types.
  24. .BE
  25.  
  26. .SH INTRODUCTION
  27. .LP
  28. \fBMkmf\fR generates a \fBMakefile\fR for the current working directory.  It
  29. also creates additional make-related files in machine-dependent
  30. subdirectories of the current directory.  \fBMkmf\fR can generate
  31. \fBMakefile\fRs for a variety of directories, including those holding programs,
  32. libraries, header libraries, kernel sources, and other things.
  33. \fBmkmf\fR manages all of the directories holding Sprite system code.
  34. In normal use, all you should have to do is type "mkmf";  \fBmkmf\fR
  35. will generate a suitable \fBMakefile\fR based on the directory's full
  36. path name and
  37. the files and subdirectories in it.  After that you can invoke
  38. \fBpmake\fR to recompile in the directory, install, and so on.  The files
  39. produced by \fBmkmf\fR will only work with \fBpmake\fR, not with the original
  40. UNIX version of \fBmake\fR (but in Sprite \fBmake\fR is a symbolic link to
  41. \fBpmake\fR).  This man page assumes that you are familiar with \fBpmake\fR;  if
  42. not, you should read the \fBpmake\fR tutorial.
  43. .LP
  44. Warning:  there is also a UNIX program called \fBmkmf\fR;  although its
  45. general goal is the same as this program's, its mechanisms are very different.
  46. .LP
  47. Normally, you should re-run \fBmkmf\fR in a directory whenever you add or delete
  48. source files.  When \fBmkmf\fR runs, it assumes that
  49. all of the source files (those with extensions .c, .h, .y, etc.)
  50. are to be used to create a single program or library, and it
  51. generates \fBMakefile\fR accordingly.  If there are source files that
  52. don't pertain to the thing being created (e.g. test programs),
  53. put them in a subdirectory where \fBmkmf\fR won't see them.
  54.  
  55. .SH "MAKEFILE STRUCTURE"
  56. .LP
  57. The makefile structure that \fBmkmf\fR generates is a bit complicated,
  58. but it's also powerful and flexible.  Among other things, it supports
  59. compilation for multiple target machines from a single set of source
  60. files, and it makes it easy to make a global change in the way all
  61. directories of a particular type are made (e.g. all command programs, or all
  62. libraries).  For most directories
  63. there are five kinds of \fBpmake\fR-related files:
  64. .IP "\fBMakefile\fP"
  65. This is the main file generated by \fBmkmf\fR, but it is short and
  66. does relatively little.  It sets up several \fBpmake\fR
  67. variables that give the name of the program, a list of target machines
  68. for which the program can be compiled, default flags for C compilation,
  69. and so on.  Then \fBMakefile\fR includes the other files described below,
  70. which contain most of the useful \fBpmake\fR-related information.
  71. \fBMakefile\fR contains information that may be different for this
  72. directory than for other directories of the same type (for example, each
  73. library has a different
  74. name), but it only contains information that is independent of the particular
  75. target machine being compiled for.
  76. .IP "\fB*.md/md.mk\fP"
  77. There is one subdirectory for each target machine that this program
  78. or library or module can be compiled to run on.  These are called
  79. \fImachine-dependent subdirectories\fR and have names \fIx\fB.md where
  80. \fIx\fR is the type of the target machine, e.g., \fBsun2.md\fR
  81. or \fBsun3.md\fR.  A machine-dependent subdirectory holds all
  82. information that is different for that particular machine than for
  83. other machines.  This includes the object files compiled for that
  84. machine, plus any machine-dependent sources.  Most user programs don't have
  85. machine-dependent sources, but many of the kernel modules and
  86. libraries do.  In each machine-dependent subdirectory there is a
  87. file \fBmd.mk\fR, generated automatically by \fBmkmf\fR.
  88. \fBMd.mk\fR is included by \fBMakefile\fR and
  89. creates variables like \fBSRCS, OBJS\fR, and \fBHDRS\fR.  These describe
  90. the files needed
  91. to recompile for that target machine, including both the machine-independent
  92. files in the parent directory (the one containing \fBMakefile\fR) and
  93. the machine-dependent files in the \fIx\fB.md\fR subdirectory.
  94. .IP "\fB*.md/dependencies.mk\fP"
  95. There is one of these files in each machine-dependent subdirectory.
  96. \fBDependencies.mk\fR lists the header files used directly or
  97. indirectly by each source file.  It is included by \fBMakefile\fR so that
  98. \fBpmake\fR will do the appropriate recompilations when headers change.
  99. \fBDependencies.mk\fR files are generated automatically by \fBmakedepend\fR.
  100. The command ``pmake depend'' will run \fBmakedepend\fR
  101. to regenerate \fBdependencies.mk\fR.  \fBMkmf\fR also issues
  102. a ``pmake depend'' command whenever it runs.
  103. .IP "\fIsysmakefile\fR"
  104. There only a few different kinds of source directories in Sprite:
  105. commands, libraries, kernel modules, etc (see ``HOW MKMF WORKS''
  106. below).  For each of these types
  107. of directories, there is one file of \fBpmake\fR commands that contains
  108. all of the ``real stuff'' that controls recompilation, installing,
  109. etc.  \fBMakefile\fR sets the variable \fBSYSMAKEFILE\fR to hold the name
  110. of this file, and under normal conditions \fBMakefile\fR will
  111. include the sysmakefile whenever \fBpmake\fR is invoked (see
  112. ``PERSONALIZATION'' below for exceptions to this rule).
  113. The sysmakefiles use the variables and dependencies set up by \fBMakefile\fR,
  114. \fBmd.mk\fR, and \fBdependencies.mk\fR.
  115. The sysmakefiles are all stored in \fB/sprite/lib/pmake\fR.
  116. .IP "\fIutility makefiles\fR"
  117. There is a collection of small makefiles in the directory
  118. \fB/sprite/lib/pmake\fR, which are include by sysmakefiles for
  119. operations that are shared by many sysmakefiles.
  120.  
  121. .SH "STANDARD TARGETS"
  122. .LP
  123. Several standard \fBpmake\fR targets are available in any directory managed
  124. by \fBmkmf\fR:
  125. .TP 14
  126. \fIdefault\fR
  127. If you type \fBpmake\fR with no arguments, then the default target
  128. just recompiles the program or library in this directory.  Compiled
  129. files are placed in the .\fBmd\fR subdirectory for the current target machine
  130. (see below for more information on target machines).
  131. .TP 14
  132. \fBclean\fR
  133. Remove any files that can be regenerated automatically by \fBpmake\fR.
  134. This frees up space on disk and forces a complete recompilation the
  135. next time \fBpmake\fR is invoked.
  136. .TP 14
  137. \fBtidy\fR
  138. Remove any files that can be regenerated automatically by \fBpmake\fR,
  139. except the executable produced for a command.
  140. This frees up space on disk and forces a complete recompilation the
  141. next time \fBpmake\fR is invoked, but it leaves around the unstripped 
  142. executable for debugging purposes.
  143. .TP 14
  144. \fBdebug\fR
  145. Valid for libraries only.  Generate a version of the library with
  146. debugging symbols.  The default for libraries is to compile without
  147. debugging information
  148. .TP 14
  149. \fBdepend\fR
  150. Regenerate the \fBdependencies.mk\fR file in the \fB.md\fR subdirectory for
  151. the current target machine.  This target should be re-made when source
  152. files are created or deleted, or when header file usage has changed.
  153. .TP 14
  154. \fBinstall\fR
  155. Recompiles the information in this directory and installs it in its
  156. official system location, so that it can be used by other people.
  157. For commands, this means copying the binary of the command to the
  158. appropriate system command directory and saving the old installed
  159. version of the command in a backup directory.  For libraries, it means
  160. copying the library's .\fBa\fR file to the relevant library directory,
  161. and also installing the library's header files and lint library.
  162. .TP 14
  163. \fBinstalldebug\fR
  164. Valid for libraries only.  Install the version of the library with
  165. debugging symbols.
  166. .TP 14
  167. \fBinstallhdrs\fR
  168. This target is only available in library and header directories.  It
  169. installs the public header files for the module in the appropriate system
  170. header directory.  \fBMkmf\fR decides
  171. which header files are public and which are private based on the files'
  172. names.  In order to be public, the first letters of a \fB.h\fR file
  173. must be the same as the name of the directory, and the string \fBInt\fR
  174. must not appear in the file's name.  Thus, in the library \fBsx\fR
  175. the file \fBsx.h\fR is public, whereas the files \fBsxInt.h\fR and
  176. \fBfoo.h\fR are treated as private.
  177. .TP 14
  178. \fBinstalllint\fR
  179. This target is only available in library directories.  It generates
  180. a lint library file for the contents of this module and installs it
  181. in the system lint library.
  182. .TP 14
  183. \fBinstallprofile\fR
  184. This target is only available in library directories.  It installs
  185. the version of the library that has been compiled for profiling.
  186. .TP 14
  187. \fBlint\fR
  188. Run lint on this program/library and the other programs and libraries
  189. it uses.  Output is placed in the file \fBlint\fR in the \fB.md\fR subdirectory
  190. for the current machine.
  191. .TP 14
  192. \fBmkmf\fR
  193. Run \fBmkmf\fR to regenerate the Makefile for this directory.   This target is
  194. particularly useful in top-level directories with many children,
  195. since it will run \fBmkmf\fR recursively in
  196. each of the subdirectories.
  197. .TP 14
  198. \fBnewtm\fR
  199. Set things up to compile for a new type of target machine (which
  200. must be specified
  201. explicitly using the \fBTM\fR variable).  This includes creating a \fB.TM\fR
  202. subdirectory and re-running \fBmkmf\fR.
  203. .TP 14
  204. \fBprofile\fR
  205. Compile a profiled version of the command or library.
  206. .TP 14
  207. \fBtags\fR
  208. Generate a \fBtags\fR file in this directory that describes all the
  209. information in all of the source files for this program or library,
  210. including both the machine-independent sources and the machine-dependent
  211. sources for all target machines.
  212.  
  213. .SH "TARGET MACHINES"
  214. .LP
  215. The above targets all apply to the ``current target machine'', which
  216. is the value of the \fBTM\fR variable in \fBMakefile\fR.  If you wish to
  217. compile for a different target machine, you can specify an explicit
  218. value of the \fBTM\fR variable on the \fBpmake\fR command line, such as
  219. .IP
  220. \fBpmake\ \ TM=sun2\fR
  221. .LP
  222. or
  223. .IP
  224. \fBpmake\ \ install\ \ TM=sun3\fR
  225. .LP
  226. There are also four other ways you can specify target machines
  227. as part of \fBpmake\fR targets:
  228. .TP 14
  229. \fItm\fR
  230. If you specify a target machine as a \fBpmake\fR target, such as
  231. \fBpmake sun2\fR, then the default target will be made for that
  232. particular machine
  233. .TP 14
  234. \fBall\fR
  235. The \fBall\fR target causes the default target to be made for all
  236. target machines currently known for this directory.
  237. .TP 14
  238. \fItarget tm\fR
  239. If you add a machine name as a suffix to one of the standard targets,
  240. e.g., \fBpmake installsun2\fR or \fBpmake lintsun3\fR, the result
  241. is equivalent to specifying the \fBTM\fR variable:  the target is
  242. re-made for the given machine instead of the default machine.
  243. .TP 14
  244. \fItarget\fBall\fR
  245. If you add the \fBall\fR suffix to a target, e.g. \fBpmake installall\fR,
  246. then \fItarget\fR will be re-made for all known target machines.
  247. .LP
  248. The list of known target machines is given by the \fBMACHINES\fR
  249. variable specified in \fBMakefile\fR.  This variable is set from the names
  250. of \fB.md\fR subdirectories at the time \fBmkmf\fR is run.  To add a new target
  251. machine, \fBfoo\fR for example, create a subdirectory \fBfoo.md\fR
  252. and then re-run \fBmkmf\fR.
  253.  
  254. .SH "ADDITIONAL PMAKE VARIABLES"
  255. .LP
  256. There are a few variable names that \fBmkmf\fR reserves exclusively
  257. for your use, as a way of controlling various things.  The makefiles
  258. generated by \fBmkmf\fR will use these variables, if you set them on a
  259. \fBpmake\fR command line:
  260. .TP 14
  261. \fBNOBACKUP\fR
  262. Normally, when a command is installed the previous version of the
  263. command is saved in a backup directory.  If you set the \fBNOBACKUP\fR
  264. variable to any value, then no backup copy will be saved.  
  265. .TP 14
  266. \fBBACKUPAGE\fR
  267. If NOBACKUP is not defined, then normally, a backup overwrites a
  268. previous backup only if the file being backed up is sufficiently old
  269. to be deemed stable (run \fBupdate -help\fR for information about the
  270. default age).  BACKUPAGE, if set, overrides the default age used for
  271. this purpose.
  272. .TP 14
  273. \fBXAFLAGS\fR
  274. Extra flags that will be used in all assembler invocations, in addition
  275. to the standard ones set up by the makefiles.
  276. .TP 14
  277. \fBXCFLAGS\fR
  278. Extra flags that will be used in all C compilations, in addition
  279. to the standard ones set up by the makefiles.
  280. .LP
  281. In addition to the variables above, you can also override other variables
  282. defined in the makefiles.  See "LOCAL.MK VARIABLES" below.
  283.  
  284. .SH "PERSONALIZATION"
  285. .LP
  286. The makefiles generated by \fBmkmf\fR won't always do the right thing
  287. without additional program-specific information.
  288. For example, a particular program may need to
  289. use additional libraries besides the C library, or it may need
  290. particular compiler switches, or certain files may need special
  291. processing during compilation.  There are six ways to personalize
  292. the information in a particular directory, each of which is
  293. invoked by creating a file with a particular name:
  294. .TP 14
  295. \fBkernel.mk\fR
  296. This file can be used to create personalized Sprite kernels.
  297. \fBMakefile\fRs in kernel module directories will check for the 
  298. existence of a \fBkernel.mk\fR file in your home directory. 
  299. If the file exists it will be included prior to including any other
  300. files. 
  301. The \fBkernel.mk\fR is intended modify the behavior of a sysmakefile
  302. for
  303. a kernel module, 
  304. not to replace it. 
  305. In this respect a \fBkernel.mk\fR file is different from a \fBlocal.mk\fR file.
  306. .TP 14
  307. \fBlocal.mk\fR
  308. This is the simplest and most common form of personalization.
  309. \fBMakefile\fR checks for the existence of \fBlocal.mk\fR;  if it
  310. exists, then \fBMakefile\fR includes it instead of the sysmakefile.
  311. Usually \fBlocal.mk\fR contains a few \fBpmake\fR commands, then it
  312. includes the sysmakefile (whose name is passed in the variable
  313. SYSMAKEFILE), then it issues a few more \fBpmake\fR
  314. commands.  See "LOCAL.MK EXAMPLES" below.
  315. .TP 14
  316. \fBMakefile.sed\fR
  317. If \fBMakefile.sed\fR exists when \fBmkmf\fR runs, then \fBmkmf\fR uses it as a Sed
  318. script to modify \fBMakefile\fR.  If the \fB\-f\fR switch has been used
  319. to specify a different makefile, say \fBfoo\fR, then \fBmkmf\fR looks for
  320. \fBfoo.sed\fR.  In particular, you can place a file \fBmd.mk.sed\fR
  321. in a machine-dependent subdirectory in order to modify the \fBmd.mk\fR
  322. file.  Most things that you can do with a
  323. \fBMakefile.sed\fR script you can also do in a \fBlocal.mk\fR file;
  324. this feature is mostly a leftover from ancient times when the
  325. \fBlocal.mk\fR facility didn't exist.
  326. .TP 14
  327. \fBMakefile.ex\fR
  328. Similar to \fBMakefile.sed\fR, except \fBmkmf\fR uses it as an Ex script to
  329. modify \fBMakefile\fR.
  330. .TP 14
  331. \fBMakefile.proto\fR
  332. If this file exists when \fBmkmf\fR runs, then \fBmkmf\fR uses it as a
  333. prototype makefile instead
  334. of one from the \fBmkmf\fR library.  See ``HOW MKMF WORKS''
  335. below for what this means.
  336. .TP 14
  337. \fBmkmf.local\fR
  338. If this file exists, it must be a shell script.  It will be executed
  339. by \fBmkmf\fR in place of the standard type-specific \fBmkmf\fR script that would
  340. normally be executed to generate \fBMakefile\fR.  See ``HOW MKMF WORKS''
  341. below for more information on this.
  342. .LP
  343. Finally, there is one other, even more radical,
  344. way for you to control what's in your \fBMakefile\fR,
  345. and that is to create your own \fBMakefile\fR from scratch
  346. and make sure it
  347. contains a line ``# No mkmf''.  \fBMkmf\fR will refuse to do anything
  348. if it finds a \fBMakefile\fR with such a comment in it;
  349. you can then put anything you like in the \fBMakefile\fR.
  350. It's probably a bad idea (and unnecessary) for you ever to generate
  351. a Makefile by hand in any Sprite system
  352. directory, but if you do, be sure it has a ``# No mkmf'' line:
  353. it is common practice to run \fBmkmf\fR indiscriminately on system directories,
  354. and this will make sure your \fBMakefile\fR doesn't accidentally
  355. get overwritten (actually, \fBmkmf\fR won't overwrite a makefile unless
  356. it finds a line ``# Allow mkmf'' in it, but if it doesn't find a
  357. ``# No mkmf'' line then it will ask for permission to overwrite it).
  358.  
  359. .SH "HOW MKMF WORKS"
  360. .LP
  361. The \fBmkmf\fR program runs as a two-stage shell script.  The top-level
  362. script is the \fBmkmf\fR program itself.  It does things that are
  363. common to all uses of \fBmkmf\fR, such as checking for the ``# Allow mkmf''
  364. line in your \fBMakefile\fR and running \fBpmake dependall\fR.
  365. There are several second-level shell scripts, called \fItype-specific\fR
  366. scripts.  Each one of these scripts is set up to handle a particular
  367. kind of directory, such as those for libraries, programs, or directories
  368. containing only header files.
  369. The type-specific scripts correspond to the sysmakefiles:  for
  370. each type, there is an \fBmkmf\fR script to generate its \fBMakefile\fR, a
  371. prototype makefile that the script fills in, and a sysmakefile in
  372. \fB/sprite/lib/pmake\fR that does most of the real work for making
  373. things of that type.
  374. The type-specific scripts and prototype makefiles are all
  375. stored in \fB/sprite/lib/mkmf\fR with names like \fBmkmf.library\fR
  376. and \fBMakefile.library\fR.
  377. .LP
  378. \fBMkmf\fR uses the file \fB/sprite/lib/mkmf/mkmf.map\fR to select
  379. which type-specific script to use.  \fBMkmf.map\fR is an awk script
  380. that performs pattern matching on the current directory to select
  381. a type-specific script.  This file has already been set up to handle
  382. most of the system areas, but if you add a major new area of programs
  383. or libraries you'll probably have to add a new entry in \fBmkmf.map\fR.
  384. If \fBmkmf\fR finds a script \fBmkmf.local\fR in the current directory, then
  385. \fBmkmf\fR uses it instead of the one that would have been selected by
  386. \fBmkmf.map\fR.  Similarly, if there is a file \fBMakefile.proto\fR
  387. in the current directory, it is used instead of the default prototype
  388. makefile.
  389. .LP
  390. You can reconfigure the way that \fBmkmf\fR works by placing a file \fB.mkmf\fR
  391. in your home directory.  If this file exists, \fBmkmf\fR will source it as a
  392. shell script just after doing its initialization.  You can use this
  393. feature to set up a private map for yourself and change other internal
  394. features of \fBmkmf\fR.  For more details on how this works, read the top-level
  395. \fBmkmf\fR script.
  396.  
  397. .SH "CURRENT TYPES"
  398. .LP
  399. Although the list of available type-dependent scripts will probably
  400. grow and change faster than this man page can be updated, here are the
  401. types that were available as of the last time the man page was
  402. updated.  To force \fBmkmf\fR to use a particular type (e.g.,
  403. ``library'' instead of ``command''), use either a \fBmkmf.local\fR or
  404. a \fBMakefile.proto\fR, as described in ``HOW MKMF WORKS,'' above.
  405. .TP 14
  406. \fBcommand\fR
  407. This type is for command directories where all of the files related
  408. to the command are together in a single directory and its \fB.md\fR
  409. subdirectories.  It is the default type used by \fBmkmf\fR for directories
  410. not explicitly listed in \fBmkmf.map\fR.
  411. \fBMakefile\fR will compile and link the command into
  412. \fItm\fB.md/\fIname\fR, where \fItm\fR is the name of a target machine
  413. and \fIname\fR is the name of the directory containing \fBMakefile\fR
  414. (the directory name and command name are assumed to be the same).
  415. \fBMakefile\fR will install the command into the appropriate system
  416. directory (see the \fBmkmf\fR scripts for details on where this is).
  417. During the conversion of Sprite to the new C library, this type of
  418. directory is actually \fBcommand2\fR, but it will revert to \fBcommand\fR
  419. when the conversion is finished.
  420. .TP 14
  421. \fBbigcmd\fR
  422. This type is for commands whose source files have been partitioned into
  423. multiple subdirectories, with one \fBMakefile\fR for each subdirectory.
  424. The \fBMakefile\fRs in the subdirectories are of type \fBbigcmd\fR,
  425. and the \fBMakefile\fR of the parent is of type \fBbigcmdtop\fR.
  426. Each \fBbigcmd\fR subdirectory contains \fItm\fB.md\fR subdirectories,
  427. which contain object files compiled from that subdirectory plus a file
  428. \fBlinked.o\fR, which consists of all the object files from that
  429. subdirectory linked together.
  430. .TP 14
  431. \fBbigcmdtop\fR
  432. This type is used for a command source directory that contains one
  433. or more subdirectories of type \fBbigcmd\fR.  The \fBMakefile\fR in this
  434. directory will cause all the children directories to be re-made,
  435. plus it will regenerate the file \fItm\fB.md/\fIname\fR, where \fItm\fR
  436. is the name of a target machine and \fIname\fR is the name of the
  437. \fBbigcmdtop\fR directory.  A special target \fBquick\fR is also available
  438. in \fBbigcmdtop\fR directories:  it will relink \fItm\fB.md/\fIname\fR
  439. using the existing \fBlinked.o\fR files from the children, without
  440. passing through all the subdirectories to remake there.
  441. .TP 14
  442. \fBlibrary\fR
  443. This type is for directories containing all of the files related to
  444. a particular library.  \fBMakefile\fR will compile all the files in
  445. the directory and assemble them into an archive file named
  446. \fItm\fB.md/lib\fIname\fB.a, where \fItm\fR is the name of a target machine
  447. and \fIname\fR is the name of the directory containing \fBMakefile\fR
  448. (the directory name and library name are assumed to be the same).
  449. \fBMakefile\fR will install the library and its headers and lint library.
  450. .TP 14
  451. \fBbiglib\fR
  452. This type is for libraries with many source files, such as the C
  453. library.  The library's sources are assumed to be split over many
  454. subdirectories, with one \fBMakefile\fR for each subdirectory.  The
  455. \fBMakefile\fRs in the subdirectories are of type \fBbiglib\fR, and
  456. the \fBMakefile\fR of the parent is of type \fBbiglibtop\fR.  Compiled
  457. files will be archived together into the
  458. file \fB../\fItm\fB.md/lib\fIname\fB.a\fR (relative to the subdirectories
  459. containing the \fBbiglib\fR \fBMakefile\fRs), where \fItm\fR is the name
  460. of a target machine and \fIname\fR is the name of the top-level
  461. directory (the directory containing the \fBbiglib\fR directories is
  462. assumed to have the same name as the overall library).
  463. .TP 14
  464. \fBbigligtop\fR
  465. This is the type of a directory that contains one or more \fBbiglib\fR
  466. subdirectories.  The \fBMakefile\fR in this directory will pass most
  467. of the standard targets along to its children directories.  The
  468. installation targets (such as \fBinstall\fR and \fBinstalllint\fR)
  469. should be invoked in this directory.  A special target \fBinstallquick\fR
  470. is also available in \fBbiglibtop\fR directories:  it will install
  471. the standard version of the library without cycling through all of
  472. the subdirectories to give each of them a chance to recompile.
  473. .TP 14
  474. \fBkernel\fR
  475. This type is used in the directories that hold the major modules of
  476. the Sprite kernel.
  477. .TP 14
  478. \fBhdrs\fR
  479. This type is used for directories that hold nothing but ``.h'' files
  480. for the standard library.  The only thing you can do with \fBpmake\fR is to
  481. install the header files;  the default target does this, as does
  482. \fBpmake install\fR.  In addition, \fBpmake recursive\fR will install
  483. header files in this directory and all of its subdirectories (this is
  484. only useful for header directories that contain more header directories
  485. as subdirectories).
  486. .TP 14
  487. \fBtop\fR
  488. This is a general-purpose type for directories that don't
  489. have anything interesting in themselves, but have child directories
  490. that do contain interesting things.  When \fBpmake\fR is run in such
  491. a directory, the \fBMakefile\fR will simply pass all the standard targets
  492. down to each of its child directories in turn.  This type of \fBMakefile\fR
  493. is used, for example, in the top-level directory of a \fBbiglib\fR
  494. tree, or in a top-level commands directory, each of whose children
  495. is of type \fBcommand\fR.
  496.  
  497. .SH "LOCAL.MK VARIABLES"
  498. .PP
  499. The following list describes some of the variables that you may wish
  500. to use, augment (using ``+=''), or override in \fBlocal.mk\fR files.
  501. This is just a list of the most commonly-used variables.  For other
  502. possibilities, read the makefiles.
  503. .TP 18
  504. \fBAFLAGS\fR
  505. Flags passed to the assembler.  You may wish to augment this in \fBlocal.mk\fR.
  506. .TP 18
  507. \fBCFLAGS\fR
  508. Flags passed to the C compiler.  You may wish to augment this in
  509. \fBlocal.mk\fR, for example to define certain compiler switches.
  510. Or, you can override the value in \fBMakefile\fR with something
  511. completely different.
  512. .TP 18
  513. \fBCLEANOBJS\fR
  514. A list of object files and other things to delete as part of
  515. \fBpmake clean\fR or \fBpmake tidy\fR.
  516. .TP 18
  517. \fBHDRS\fR
  518. A list of all the locally-defined ``.h'' files (both machine-dependent
  519. and machine-independent) used to compile this module.
  520. .TP 18
  521. \fBINSTALLDIR\fR
  522. The base directory in which a program gets installed.  \fBMkmf\fR will add
  523. a machine-dependent suffix onto this, depending on the particular
  524. machine being compiled for (see the makefiles for more details on this).
  525. .TP 18
  526. \fBINSTALLFLAGS\fR
  527. Flags passed to \fBupdate\fR when the module is installed.  You may wish
  528. to add extra flags, like \fB\-m 4755\fR to make a program set-user-id.
  529. .TP 18
  530. \fBOBJS\fR
  531. A list of all the object files used to link together this module.
  532. These files should always be in a machine-dependent directory.
  533. .TP 18
  534. \fBSRCS\fR
  535. A list of all the source files (both machine-dependent and
  536. machine-independent) that comprise the module's version for the
  537. current target machine.
  538. .TP 18
  539. \fBSUBDIRS\fR
  540. A list of all the subdirectories of this directory, except those of
  541. type \fItm\fB.md\fR).  Is usually only
  542. available in top-level Makefiles, like those in directories of type
  543. \fBtop\fR, \fBbigcmdtop\fR, or \fBbiglibtop\fR.  This variable determines
  544. where to invoke recursive sub-makes.
  545. .TP 18
  546. \fBTM\fR
  547. The name of the current target machine.  Normally this is specified on
  548. the command line or defaulted in \fBMakefile\fR, so you shouldn't
  549. modify it.
  550.  
  551. .SH "LOCAL.MK EXAMPLES"
  552. .PP
  553. The normal structure for a \fBlocal.mk\fR file is for it to set
  554. up or modify a few variables, include the sysmakefile, and then
  555. add new targets or extend targets defined by the sysmakefile.
  556. For example, here is a simple \fBlocal.mk\fR that defines some
  557. additional compiler variables (by adding to \fBCFLAGS\fR) and
  558. uses an extra library:
  559. .DS
  560. \fBCFLAGS    += -DNAME=testProg
  561. LIBS        += -lm\ \ -X11
  562. #include    <$(SYSMAKEFILE)>\fR
  563. .DE
  564. .LP
  565. Or, below is a \fBlocal.mk\fR that generates an additional C file from
  566. a template.  Since the file may not have existed when \fBmkmf\fR was run, it
  567. must be added to the \fBSRCS\fR and \fBOBJS\fR variables generated by
  568. \fBmkmf\fR.  In addition, when this program is installed (using the \fBupdate\fR
  569. command), it is marked at set-user-id (mode 4755):
  570. .DS
  571. \fBSRCS            += auto.c
  572. OBJS            += $(TM).md/auto.o
  573. INSTALLFLAGS    += -m 4755
  574.  
  575. #include        <$(SYSMAKEFILE)>
  576.  
  577. auto.c: template prog
  578.     prog template > auto.c\fR
  579. .DE
  580. .LP
  581. The reason for adding new targets after including the sysmakefile
  582. is to allow the sysmakefile to define the first target, which is the
  583. default that will be made if \fBpmake\fR is invoked with no arguments.  If,
  584. on the other hand, you want to change the default target, then you
  585. can define the default target before including the sysmakefile.
  586. .LP
  587. As a third example, consider a program that uses non-standard header
  588. files.  It would have a local.mk that looks something like
  589. .DS
  590. \fB#include    <$(SYSMAKEFILE)>
  591.  
  592. \&.PATH.h :    /sprite/lib/include.special
  593. .DE
  594. .LP
  595. Notice that the 
  596. .B .PATH.h
  597. line comes after the sysmakefile is included.
  598.  
  599. .SH "SEE ALSO"
  600. pmake, sed, ex
  601.  
  602. .SH KEYWORDS
  603. make, Makefile, prototype
  604.